<template>
  <div class="hotradio">
    <div class="title" title="更多电台">
      <i
        class="iconfont icon-circleyuanquan"
        :style="{ color: themeColor }"
      ></i>
      <h3 style="margin-left: 0.625rem">主播电台</h3>
      <i class="el-icon-arrow-right"></i>
    </div>
    <div class="playlist">
      <div class="playlist-item" v-for="item in hotRadio" :key="item.id">
        <div class="resource-item">
          <div class="resource-img">
            <el-image class="img" :src="item.picUrl"> </el-image>
            <div class="tooltip">
              <i class="iconfont icon-erji"></i>
              {{ item.dj.nickname }}
            </div>
          </div>
          <span class="resource-text" :title="item.name">{{ item.name }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getHotRadio } from "@/api/radio.js";
export default {
  name: "hotradio",
  components: {},
  props: {
    themeColor: {
      type: String
    }
  },
  data() {
    return {
      theme: "",
      userInfo: "",
      hotRadio: ""
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getHotRadio();
    this.userInfo = JSON.parse(localStorage.getItem("userInfo"));
  },
  mounted() {},
  methods: {
    async getHotRadio() {
      const { data } = await getHotRadio();
      this.hotRadio = data.data;
    }
  }
};
</script>

<style lang="scss" scoped>
.el-row {
  margin-bottom: 1.25rem;
  flex-wrap: wrap;

  &:last-child {
    margin-bottom: 0;
  }
}

.el-col {
  border-radius: 0.25rem;
}

.playlist {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5rem;

  .playlist-item {
    width: 16.666%;
    box-sizing: border-box;
    // flex: 20%;
    padding: 0.9375rem 0.625rem;
    cursor: pointer;

    .resource-item {
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      box-sizing: border-box;
      overflow: hidden;

      .tooltip {
        box-sizing: border-box;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.4));
        height: 1.875rem;
        z-index: 2;
        text-align: left;
        line-height: 1.875rem;
        color: #fff;
        padding: 0 0.625rem;
        transition: all 0.6s;
      }

      .resource-img {
        position: relative;
        width: 100%;
        height: 12.5rem;
        border-radius: 0.625rem;
        // background: red;

        .el-image {
          width: 100%;
          height: 100%;
          border-radius: 0.625rem;
        }
      }

      .resource-text {
        line-height: 1.875rem;
        text-align: left;
        margin: 0 auto;
        font-size: 1rem;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
    }
  }
}

.bg-purple-dark {
  background: #99a9bf;
}

.bg-purple {
  background: #d3dce6;
}

.bg-purple-light {
  background: #e5e9f2;
}

.grid-content {
  border-radius: 0.25rem;
  height: 15rem;

  .resource-img {
    width: 100%;
    height: 100%;
  }
}

.row-bg {
  padding: 0.625rem 0;
  background-color: #f9fafc;
}

.title {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  height: 3.125rem;
  margin: 0;
  font-size: 1.125rem;
  cursor: pointer;
  .el-icon-arrow-right {
    cursor: pointer;
  }
}
</style>
